<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>编辑定时任务</title>
</head>
<style>
    *{font-size: 12px;}
    td img {width:80px; height:80px}
    table tr th {border-bottom: 1px solid #aaaaaa; background: #eeeeee; min-width: 85px;}
    table tr td {border-bottom: 1px solid #cccccc; min-width: 85px;}
</style>

<body th:with="nowDate=${#dates.format(new java.util.Date().getTime(), 'yyyy-MM-dd')}">
<form th:method="POST" th:action="@{/saveBaseJob}">
    <div th:if="${not #strings.isEmpty(job.jobId)}">
        <input type="hidden" name="jobId" th:value="${job.jobId}"/>
    </div>
    <div th:object="${job}">
        <div>
            <laber>任务名</laber>
            <input th:type="text" name="jobName" th:value="*{jobName}"/>
        </div>
        <div>
            <laber>类路径</laber>
            <input th:type="text" name="className" th:value="*{className}"/>
        </div>
        <div>
            <laber>方法名</laber>
            <input th:type="text" name="method" th:value="*{method}"/>
        </div>
        <div>
            <laber>参数</laber>
            <input th:type="text" name="params" th:value="*{params}"/>
        </div>
        <div>
            <laber>cron表达式</laber>
            <input th:type="text" name="cron" th:value="*{cron}"/>
        </div>
        <div>
            <laber>有效状态</laber>
            <select name="state"/>
                <option id="succ" value="1">有效</option>
                <option id="fail" value="0">无效</option>
            </select>
        </div>
        <button th:type="submit">保存</button>
    </div>
</form>
</body>
<script type="text/javascript" th:inline="javascript">
    /*<![CDATA[*/
    document.addEventListener('DOMContentLoaded',
        function(){
            var succ = document.getElementById("succ");
            var fail = document.getElementById("fail");
            var i = [[${job.state}]];
            if (i == 1) {
                succ.selected = true;
            } else {
                fail.selected = true;
            }
        },
        false);
    /*]]>*/
</script>
</html>
